package com.cs543.j.client.comm;

import cs543.library.rmi.RmiClientInterface;
import org.json.JSONArray;

public class RemoteCloudCommunication extends RmiClientInterface {
public RemoteCloudCommunication (String name) {
super (name);
}

public String delete (String path) {
JSONArray args = new JSONArray ();
String ret = "";
args.put (path);
JSONArray rep = invoque ("CloudCommunication", "delete", args);
try{
ret = rep.getString (0);
} catch (Exception e) {}
return ret;
}
public String copy (String targetPath, String client, String path) {
JSONArray args = new JSONArray ();
String ret = "";
args.put (targetPath);
args.put (client);
args.put (path);
JSONArray rep = invoque ("CloudCommunication", "copy", args);
try{
ret = rep.getString (0);
} catch (Exception e) {}
return ret;
}
public String move (String newPath, String path) {
JSONArray args = new JSONArray ();
String ret = "";
args.put (newPath);
args.put (path);
JSONArray rep = invoque ("CloudCommunication", "move", args);
try{
ret = rep.getString (0);
} catch (Exception e) {}
return ret;
}
public String download (String data, String path) {
JSONArray args = new JSONArray ();
String ret = "";
args.put (data);
args.put (path);
JSONArray rep = invoque ("CloudCommunication", "download", args);
try{
ret = rep.getString (0);
} catch (Exception e) {}
return ret;
}
public String upload (String data, String path) {
JSONArray args = new JSONArray ();
String ret = "";
args.put (data);
args.put (path);
JSONArray rep = invoque ("CloudCommunication", "upload", args);
try{
ret = rep.getString (0);
} catch (Exception e) {}
return ret;
}
public String lookup (String path) {
JSONArray args = new JSONArray ();
String ret = "";
args.put (path);
JSONArray rep = invoque ("CloudCommunication", "lookup", args);
try{
ret = rep.getString (0);
} catch (Exception e) {}
return ret;
}
}